import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      name: "Layout",
      redirect: "/user/list",
      component: () => import("../views/Layout/index.vue"),
      children: [
        {
          path: "/home",
          name: "Home",
          component: () => import("../views/Home/index.vue"),
        },
        {
          path: "/about",
          name: "About",
          component: () => import("../views/About/index.vue"),
        },
        {
          path: "/user/list",
          name: "UserList",
          component: () => import("../views/User/list.vue"),
        },
        {
          path: "/role/list",
          name: "RoleList",
          component: () => import("../views/Role/list.vue"),
        },
        {
          path: "/comp/list",
          name: "CompList",
          component: () => import("../views/Comp/list.vue"),
        },
        {
          path: "/template/list",
          name: "TemplateList",
          component: () => import("../views/Template/list.vue"),
        },
      ],
    },
    {
      path: "/login",
      name: "Login",
      component: () => import("../views/Login/index.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      name: "404",
      component: () => import("../views/404/index.vue"),
    },
  ],
});

export default router;
